Extract DepKindVTable constructors to their own module#152515
Extract DepKindVTable constructors to their own module#152515rust-bors[bot] merged 1 commit intorust-lang:mainfrom
DepKindVTable constructors to their own module#152515Conversation
| #[expect(unused_imports, reason = "used by doc comments")] | ||
| use rustc_middle::dep_graph::DepKindVTable; |
There was a problem hiding this comment.
At first I tried using #[cfg(doc)] here, but that seems to break the ability to follow the link by command-clicking, at least in rust-analyzer.
| data: PhantomData<&'tcx ()> | ||
| } | ||
|
|
||
| pub(crate) const IS_EVAL_ALWAYS: bool = is_eval_always!([$($modifiers)*]); |
There was a problem hiding this comment.
In #152435 I experimented with making this a field in QueryFlags instead.
The perf results were inconclusive, so for this PR I decided not to bundle that change.
There was a problem hiding this comment.
This doesn't feel like a win. It introduces a new thing that has a single use. The name is similar enough to the old name that it's not any clearer.
There was a problem hiding this comment.
I thought "maybe it gets used in a couple of additional places in the next commit", but no.
There was a problem hiding this comment.
It made sense as part of pulling out the separate macro in another module, but if we aren't pulling out the macro then it isn't doing much anymore.
There was a problem hiding this comment.
Ok. r=me with the first commit removed.
There was a problem hiding this comment.
I like that the functions Null, Red, etc., are pulled out of the macro.
I'm less keen on having another call to rustc_with_all_queries!. This new macro feels like it belongs with define_dep_nodes!, because that also has the same pattern of "all the queries + the special dep kinds (Null/Red/...)".
Do you think there's a way this DepKindVTable stuff could be combined with the dep_kind stuff? Because we currently list the special dep kinds in two locations, which allows for them to get out of sync.
I was prepared for possible pushback on that, so I'm perfectly fine with putting it back in the central macro. Note that we only use macro-generated code for the query dep kinds; the non-query ones all have hand-written dep-node-vtable constructors. And the macro that combines them all into one array (
Note that |
49fa7da to
8a54128
Compare
This comment has been minimized.
This comment has been minimized.
8a54128 to
5c80768
Compare
|
And I still hate the "macro that produces a macro" pattern, but that's pre-existing. |
5c80768 to
295fa92
Compare
This comment has been minimized.
This comment has been minimized.
295fa92 to
de04914
Compare
|
First commit introducing @bors r=nnethercote |
Rollup of 17 pull requests Successful merges: - #150551 (Compute localized outlives constraints lazily) - #150988 (Improve code suggestion for incorrect macro_rules! usage) - #152422 (Change query proc macro to be more rust-analyzer friendly) - #152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto) - #152514 (Collect active query jobs into struct `QueryJobMap`) - #152520 (Don't use `DepContext` in `rustc_middle::traits::cache`) - #152528 (Support serializing CodegenContext) - #152082 (Move tests) - #152232 (Add must_use for FileTimes) - #152329 (Simplify parallel! macro) - #152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion) - #152486 (remove redundant backchain attribute in codegen) - #152519 (Fix feature gating for new `try bikeshed` expressions) - #152529 (sparc64: enable abi compatibility test) - #152548 (reject inline const patterns pre-expansion) - #152550 (Port #[prelude_import] to the attribute parser) - #152552 (Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks) Failed merges: - #152515 (Extract `DepKindVTable` constructors to their own module)
…ercote Extract `DepKindVTable` constructors to their own module This is a fairly substantial chunk of code in `rustc_query_impl::plumbing` that mostly doesn't need to be inside a macro at all. The part that does need to be in a macro is the declaration of a named vtable constructor function for each query. I have extracted that into its own separate call to `rustc_middle::rustc_with_all_queries!` in the new module, so that dep-kind vtable construction is almost entirely confined to `rustc_query_impl::dep_kind_vtables`. There should be no change to compiler behaviour. r? nnethercote (or compiler)
This comment has been minimized.
This comment has been minimized.
de04914 to
1d6ef95
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Rebased over trivial import conflict. @bors r=nnethercote |
…uwer Rollup of 14 pull requests Successful merges: - #152323 (Fix ICE in borrowck when recovering `fn_sig` for `-> _`) - #152469 (Remove unused features) - #152515 (Extract `DepKindVTable` constructors to their own module) - #152555 (Port `#[rustc_diagnostic_item]` to the new attribute parsers) - #152218 (Report unconstrained region in hidden types lazily) - #152356 (Improve the `inline_fluent!` macro) - #152392 (Fix ICE in supertrait_vtable_slot when supertrait has missing generics) - #152407 (Add regression test for type_const with unit struct ctor under mGCA) - #152440 (Fix typos and grammar in compiler and build documentation) - #152536 (bootstrap: add explicit UTF-8 encoding to text-mode open() calls) - #152554 (Remove `deprecated_safe` and its corresponding feature gate) - #152556 (doc: move riscv64a23-unknown-linux-gnu to tier 2) - #152563 (Replace "bug" with "issue" in triagebot ping messages) - #152565 (fix missleading error for tuple ctor) Failed merges: - #152512 (core: Implement feature `float_exact_integer_constants`) - #152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser)
…uwer Rollup of 14 pull requests Successful merges: - #152323 (Fix ICE in borrowck when recovering `fn_sig` for `-> _`) - #152469 (Remove unused features) - #152515 (Extract `DepKindVTable` constructors to their own module) - #152555 (Port `#[rustc_diagnostic_item]` to the new attribute parsers) - #152218 (Report unconstrained region in hidden types lazily) - #152356 (Improve the `inline_fluent!` macro) - #152392 (Fix ICE in supertrait_vtable_slot when supertrait has missing generics) - #152407 (Add regression test for type_const with unit struct ctor under mGCA) - #152440 (Fix typos and grammar in compiler and build documentation) - #152536 (bootstrap: add explicit UTF-8 encoding to text-mode open() calls) - #152554 (Remove `deprecated_safe` and its corresponding feature gate) - #152556 (doc: move riscv64a23-unknown-linux-gnu to tier 2) - #152563 (Replace "bug" with "issue" in triagebot ping messages) - #152565 (fix missleading error for tuple ctor) Failed merges: - #152512 (core: Implement feature `float_exact_integer_constants`) - #152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser)
Rollup merge of #152515 - Zalathar:dep-kind-vtables, r=nnethercote Extract `DepKindVTable` constructors to their own module This is a fairly substantial chunk of code in `rustc_query_impl::plumbing` that mostly doesn't need to be inside a macro at all. The part that does need to be in a macro is the declaration of a named vtable constructor function for each query. I have extracted that into its own separate call to `rustc_middle::rustc_with_all_queries!` in the new module, so that dep-kind vtable construction is almost entirely confined to `rustc_query_impl::dep_kind_vtables`. There should be no change to compiler behaviour. r? nnethercote (or compiler)
This is a fairly substantial chunk of code in
rustc_query_impl::plumbingthat mostly doesn't need to be inside a macro at all.The part that does need to be in a macro is the declaration of a named vtable constructor function for each query. I have extracted that into its own separate call to
rustc_middle::rustc_with_all_queries!in the new module, so that dep-kind vtable construction is almost entirely confined torustc_query_impl::dep_kind_vtables.There should be no change to compiler behaviour.
r? nnethercote (or compiler)